<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		
		<style type="text/css">
			.disp{border:0px;border-style:none;background-color:#99CCFF;}
			table.formTable tr {height:38px;}
			td  {height:30px;}
			.all_div {
			  width:100%;
			  float: left;  /* 左方向にフロート */
			  position:relative;
			}
			 
			/* 左カラム固定・右カラム可変 */
			.l_div {
			  width:53.9%;
			  float: left;  /* 左方向にフロート */
			}
			 
			.r_div {
			 /*float: right;  右方向にフロート*/ 
			  width:46%;
			  z-index:300;
			  overflow-x:auto;
			  overflow-y:hidden;
			}
		</style>
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./assets/scripts/tiny_mce/tiny_mce.js"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts/search.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('#btn-export').click(function(){	
				if(confirm('ダウンロードしますか？')){
					document.fm.csv.value="download";
					document.fm.submit();
				}
			});

			$('#btn-reset').click(function(){	
				location.href = document.fm.action;
			});
			
			$('#btn_search').click(function(){	
				if (chkWeek()) {
					document.fm.csv.value="";
					document.fm.submit();
				}
			});
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			$('#year4').change(function(){
				var year4 = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
				$.get("mmap_week_ajax.php",{ y: year4,t : nowtime }, function(data){
					$("#week_cd").children().remove();
					$("#week_cd").append( data ); 
				});
			});	
		});
		$(document).ready(function(){
			// OnLoadイベントより前に実行される
			 heightResize();
		});
		function chkWeek() {
			var weekid = $("#week_cd").val() ;
			if (weekid.length == 0){
				alert("週を選択してください");
				return false;
			 }
			return true;
		}
		function toPage(thepage) {
			document.fm.page.value =  thepage;
			document.fm.csv.value="";
			document.fm.submit();
		}
		function setSS( valcd, valnm ) {
			if (gPara == "shop") {
				document.fm.shop_cd.value = valcd;
				document.fm.shop_name.value = valnm;			
			}
			if (gPara == "mediaid") {
				document.fm.media_cd.value = valcd;
				document.fm.media_name.value = valnm;			
			} 
			$('#dialog').dialog("close");
		}
		
		function heightResize (){
			var l_th_height = $('.l_div th').height();
			var l_td_height = $('.l_div td').height();
			$('.r_div th').css('height',l_th_height+'px');
			$('.r_div td').css('height',l_td_height+'px');
		}
		$(window).resize(heightResize);
		
		</script>
		<link rel="stylesheet" type="text/css" href="./assets/styles/tablesorter.css" />
		<script type="text/javascript" src="./assets/scripts/tablesorter.js"></script>
	</head>
	<body id="">
	{{$menu}}
	{{$logout}}
		<div id="container"><div class="wrapper">
			<h2>DM経費マスター管理</h2>
			<ul class="submenu clearfix">
				<li>一覧.更新</li>
				<li><a href="mcost_dm_d_import.php">明細表登録</a></li>
				<li><a href="mcost_dm_c_import.php">件数表登録</a></li>
				<li><a href="mcost_dm_price.php">DM単価マスタ</a></li>
				{{	if ($now_menu.mcost_dm_plane_index.auth) }}<li><a href="mcost_dm_plane_index.php">経費一覧.更新</a></li>{{ /if }}
				{{	if ($now_menu.mcost_dm_plane_import.auth) }}<li><a href="mcost_dm_plane_import.php">経費一括登録</a></li>{{ /if }}
			</ul>
			<h3>DM経費一覧.更新　</h3>
			<form name="fm" id="fm" method="get" action="mcost_dm_index.php" >
				<input type="hidden" name="page" />
				<table class="formTable searchTable">
					<tbody>
						<tr>
							<th><span>※</span>配布日</th>
							<td>
								{{ html_options id='year4' name='year4' options=$year4 selected=$forms.year4 }} 年{{ $err.year4 }}
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ html_options id='week_cd' name='week_cd' options=$week  selected=$forms.week_cd }}{{ $err.week_cd }} 週
							</td>
						</tr>
					</tbody>
				</table>
				<p class="button" style="text-align:right">
					<button type="button" id="btn-reset"><span>クリア</span></button>
					<button type="button" id="btn_search" class="submit"><span>絞込検索</span></button>
				</p>
				<input type="hidden" name="search" value="1" />
				<input type="hidden" name="csv" />
			</form>
{{ if is_numeric($page.cnt) }}
	{{ if $page.cnt > 0 }}
				<p class="message">{{ $page.cnt }}件の情報が見つかりました。</p>
				<p align="left">{{$pageing}}</p>
		 <div class="l_div"> 
				<table id="search_result" class="sortable" style="table-layout:fixed;word-wrap:break-word;word-break;break-all;">
					<thead>
						<tr>
							<th style="width:35px" ><h3>明細<br>更新</h3></th>
							<th style="width:60px"><h3>投函日<br>該当週名</h3></th>
							<th style="width:60px" ><h3>セール期間<br>開始日/終了日</h3></th>
							<th style="width:60px"><h3>DM<br>投函日</h3></th>
							<!--<th style="width:50px"><h3>DMコード</h3></th>-->
							<th style="width:40px"><h3>差替ＮＯ</h3></th>
							<th style="width:30px"><h3>店舗数</h3></th>
							<th style="width:50px"><h3>部数合計</h3></th>
						</tr>
					</thead>
					<tbody>
	{{ $nowindex =0 }}
	{{ foreach from=$data key=k item=v name="member" }}
						<tr class="{{cycle values=odd,mod name='member'}}">
						<td class="center"><a href="mcost_dm_form.php?id={{ $v.id}}" class="tdbutton tdb2">更新</a></td>
						<td >{{ $v.weekbe }}<br>{{ $v.weeknm }}</td>
						<td align=center>{{ $v.begin_date }}<br>{{ $v.end_date }}</td>
						<td align=center>{{ $v.dm_date }}</td>
						<!--  <td align=center style="width:30px">{{ $v.dm_cd }}</td> -->
						<td>{{ $v.dm_no }} </td>
						<td  align=right>{{ $v.scnt|number_format  }} </td>
						<td  align=right>{{ $v.ssum|number_format }} </td>
						</tr>
	{{ /foreach }}
					</tbody>
				</table>
			</div>
<div class="r_div" style="table-layout:fixed;word-wrap:break-word;word-break;break-all;"> 
		<table id="search_result" class="sortable" style="width:2800px;table-layout:fixed;word-wrap:break-word;word-break;break-all;">
		<thead>
		<tr>
		<th><h3>タイトル</h3></th>
		<th><h3>種類</h3></th>
		<th><h3>ハガキ<br>表</h3></th>
		<th><h3>ハガキ<br>裏</h3></th>
		<th><h3>封筒</h3></th>
		<th><h3>プレ券<br>表</h3></th>
		<th><h3>プレ券<br>裏</h3></th>
		<th><h3>割引券<br>表</h3></th>
		<th><h3>割引券<br>裏</h3></th>
		<th><h3>宛名<br>表</h3></th>
		<th><h3>宛名<br>裏</h3></th>
		<th><h3>ペラ１<br>表</h3></th>
		<th><h3>ペラ１<br>裏</h3></th>
		<th><h3>ペラ2<br>表</h3></th>
		<th><h3>ペラ2<br>裏</h3></th>
		<th><h3>挨拶状<br>表</h3></th>
		<th><h3>挨拶状<br>裏</h3></th>
		<th><h3>本状<br>表</h3></th>
		<th><h3>本状<br>裏</h3></th>
		<th><h3>その他１</h3></th>
		<th><h3>その他２</h3></th>
		<th><h3>その他３</h3></th>
		<th><h3>その他４</h3></th>
		<th><h3>その他５</h3></th>
		</tr>
		</thead>
		<tbody>
	{{ $nowindex =0 }}
	{{ foreach from=$data key=k item=v name="member" }}
		<tr class="{{cycle values=odd,mod name='member'}}">
			<td>{{ $v.title }}</td>
			<td >{{ $dm_sort[$v.sort]}}</td>
			<td >{{ $v.haga_out|escape }}</td>
			<td >{{ $v.haga_in|escape }}</td>
			<td >{{ $v.futou|escape }}</td>
			<td >{{ $v.preken_out|escape }}</td>
			<td >{{ $v.preken_in|escape }}</td>
			<td >{{ $v.wariken_out|escape }}</td>
			<td >{{ $v.wariken_in|escape }}</td>
			<td >{{ $v.atemei_out|escape }}</td>
			<td >{{ $v.atemei_in|escape }}</td>
			<td >{{ $v.pera1_out|escape }}</td>
			<td >{{ $v.pera1_in|escape }}</td>
			<td >{{ $v.pera2_out|escape }}</td>
			<td >{{ $v.pera2_in|escape }}</td>
			<td >{{ $v.ayisatu_out|escape }}</td>
			<td >{{ $v.ayisatu_in|escape }}</td>
			<td >{{ $v.honjyou_out|escape }}</td>
			<td >{{ $v.honjyou_in|escape }}</td>
			<td >{{ $v.other1|escape }}</td>
			<td >{{ $v.other2|escape }}</td>
			<td >{{ $v.other3|escape }}</td>
			<td >{{ $v.other4|escape }}</td>
			<td >{{ $v.other5|escape }}</td>
		</tr>
	{{ /foreach }}
					</tbody>
				</table>
</div>
				<p align="right">{{$pageing}}</p>
					<p class="button">
						<button type="button" id="btn-export"  ><span>CSVダウンロード</span></button>
					</p>
	{{ else }}
	<p class="message">条件にマッチする情報は見つかりませんでした。</p>
	{{ /if }}
{{ else }}
	<p class="message">ここに検索結果が表示されます。</p>
{{ /if }}
<div id="dialog" >
</div>
		</div></div>
		{{ $footer }}
	</body>
</html>